Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert code base to ESM import #3778

Merged
merged 4 commits into from
Jun 9, 2017
Merged

Convert code base to ESM import #3778

merged 4 commits into from
Jun 9, 2017

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Jun 9, 2017

Summary

This is just the require -> ESM parts of #3493. Split off in order to land it and make it easier to diagnose the test failures. The same 2 tests fail as with the other PR. Halp.

Test plan
Tests should pass.

@SimenB
Copy link
Member Author

SimenB commented Jun 9, 2017

Summary of all failing tests
 FAIL  packages/jest-snapshot/src/__tests__/utils-test.js
  ● serialize handles \r\n

    SyntaxError: /Users/simbekkh/repos/jest/packages/pretty-format/package.json: Error while parsing JSON - Unexpected token u in JSON at position 0
        at Object.parse (native)

      at ConfigChainBuilder.addConfig (packages/babel-jest/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:150:65)

 FAIL  integration_tests/__tests__/symbol-test.js
  ● Symbol deletion

    TypeError: Cannot read property 'prototype' of undefined

      at Object.<anonymous> (packages/jest-jasmine2/node_modules/jest-matchers/node_modules/jest-matcher-utils/node_modules/pretty-format/build/index.js:47:30)

package.json Outdated
@@ -10,6 +10,7 @@
"babel-plugin-transform-es2015-destructuring": "^6.23.0",
"babel-plugin-transform-es2015-parameters": "^6.23.0",
"babel-plugin-transform-flow-strip-types": "^6.18.0",
"babel-plugin-transform-inline-imports-commonjs": "^1.2.0",
"babel-plugin-transform-runtime": "^6.23.0",
Copy link
Collaborator

@thymikee thymikee Jun 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be in this PR? I mean babel-plugin-transform-inline-imports-commonjs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, good catch. Wrong plugin!

@SimenB
Copy link
Member Author

SimenB commented Jun 9, 2017

Bah, didn't change .babelrc. Only one failure!

Summary of all failing tests
 FAIL  integration_tests/__tests__/symbol-test.js
  ● Symbol deletion

    TypeError: Cannot read property 'prototype' of undefined

      at Object.<anonymous> (packages/jest-jasmine2/node_modules/jest-matchers/node_modules/jest-matcher-utils/node_modules/pretty-format/build/index.js:47:30)

@orta
Copy link
Member

orta commented Jun 9, 2017

👌

@@ -5,7 +5,8 @@
"transform-es2015-destructuring",
"transform-es2015-parameters",
"transform-async-to-generator",
"transform-strict-mode"
"transform-strict-mode",
["transform-es2015-modules-commonjs", {"allowTopLevelThis": true}]
Copy link
Member Author

@SimenB SimenB Jun 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the allowTopLevelThis option, otherwise this throws. Might not be an issue, not sure?

@SimenB
Copy link
Member Author

SimenB commented Jun 9, 2017

I apparently hit a bug in node 6.10.1. Upgrading to 6.11.0 and all tests pass.

Pushed an empty commit to trigger CI.

@cpojer cpojer merged commit dec54a3 into jestjs:master Jun 9, 2017
@SimenB SimenB deleted the esm-import branch June 9, 2017 15:04
@jest-bot
Copy link
Contributor

jest-bot commented Jun 9, 2017

Warnings
⚠️ Changes were made to package.json, but not to yarn.lock - Perhaps you need to run `yarn install`?

Generated by 🚫 dangerJS

@codecov-io
Copy link

Codecov Report

Merging #3778 into master will decrease coverage by 1.72%.
The diff coverage is 44.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3778      +/-   ##
==========================================
- Coverage   59.82%   58.09%   -1.73%     
==========================================
  Files         191      191              
  Lines        7016     6708     -308     
  Branches        6        6              
==========================================
- Hits         4197     3897     -300     
+ Misses       2816     2808       -8     
  Partials        3        3
Impacted Files Coverage Δ
packages/jest-matchers/src/asymmetric-matchers.js 90.14% <ø> (-0.14%) ⬇️
packages/jest-matchers/src/spyMatchers.js 95.16% <ø> (-0.16%) ⬇️
packages/jest-haste-map/src/getMockName.js 100% <ø> (ø) ⬆️
packages/jest-changed-files/src/git.js 92.3% <ø> (-0.55%) ⬇️
packages/jest-cli/src/reporters/Status.js 4.68% <ø> (-2.89%) ⬇️
...es/pretty-format/src/plugins/ReactTestComponent.js 100% <ø> (ø) ⬆️
packages/jest-cli/src/TestSequencer.js 100% <ø> (ø) ⬆️
packages/jest-changed-files/src/hg.js 86.66% <ø> (-0.84%) ⬇️
packages/jest-util/src/FakeTimers.js 90.9% <ø> (-0.1%) ⬇️
packages/jest-editor-support/src/TestReconciler.js 77.55% <ø> (-0.45%) ⬇️
... and 158 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 21e8a2a...ca3b650. Read the comment docs.

tushardhole pushed a commit to tushardhole/jest that referenced this pull request Aug 21, 2017
* Convert code base to ESM import

* [squash] specify correct babel plugin for import transpilation

* [squash] specify correct babel plugin for import transpilation in babelrc

* trigger ci
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants